﻿using MES.Core;
using MES.Model.System;
using MES.Service.System.Permission;
using Microsoft.AspNetCore.Mvc;

namespace MES.API.Controllers.System
{
    /// <summary>
    /// 权限管理
    /// </summary>
    [Route("api/[controller]/[Action]")]
    [ApiVersion("1.0", Deprecated = false)]
    [ApiController]
    public class PermissionController : ControllerBase
    {

        private readonly IPermissionServer _permissionService;
        public PermissionController(IPermissionServer permissionService)
        {
            _permissionService = permissionService;
        }

        /// <summary>
        /// 添加权限
        /// </summary>
        /// <param name="permission"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<OperateResult> AddPermissionAsync([FromBody] Sys_Permission permission)
        {
            return await _permissionService.AddPermissionAsync(permission);
        }
    }
}
